﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
using System.Drawing;
using Website.Logger;
using DAL;
using BOL;
using System.Web.Script.Services;
using System.Web.Services;
using WebLib;
using UtilityExtensions;


namespace UILGestion.AlmacenAdmin
{
    public partial class StockListForm : System.Web.UI.Page
    {


        [WebMethod(), ScriptMethod()]
        public static string GetRecursos(String prefixText, String contextKey)
        {


            KardexBL bol = new KardexBL();
            return Util.Tbl2Str(Util.EntidadToDataTable(bol.getSaldoActualList(contextKey.ToInt(),
                DateTime.Now.Year,
                DateTime.Now.Month,
                DateTime.Now.Day,
                30,
                prefixText)));


        }
        //private static int idTipoInsumo;

         protected void Page_Load(object sender, EventArgs e)
        {
            try
            {

                InsumoInput.ChkVal = (string)Request.QueryString["idAlmacen"];

                if (!Page.IsPostBack)
                {

                    
                    idObra.Value = (string)Request.QueryString["idObra"];

                    idAlmacen.Value = (string)Request.QueryString["idAlmacen"];

                    menuObraCtrl1.loadMenuAlmacen(int.Parse(idObra.Value), int.Parse(idAlmacen.Value)); 
                   

                    FormatForm();

               

                }


            }
            catch (SqlException sqlex)
            {
                WebServerSideSqlError.Log(sqlex);
                ScriptManager.RegisterClientScriptBlock(this, typeof(Page),
                 "uniqueKey" + DateTime.Now, "alert('" + sqlex.Message.Replace("'", "") + "');", true);


            }
            catch (Exception ex)
            {
                WebServerSideError.Log(ex);
                ScriptManager.RegisterClientScriptBlock(this, typeof(Page),
                 "uniqueKey" + DateTime.Now, "alert('" + ex.Message.Replace("'", "") + "');", true);

            }

        }

         private void FormatForm()
         {

             tituloFormLBL.Text = "SALDO ACTUAL {0}-{1}".Fmt(DateTime.Now.Month, DateTime.Now.Year);

         }

         //protected void Button1_Click(object sender, EventArgs e)
         //{
            
         //    string insumo=InsumoInput.Text.ToUpper();

            
         //}


        
    }
}